<template>
	<view class="content">
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
	<view class="text-area1">
	 手机号：<input v-model="userform.ipone" placeholder="输入您的手机号">
	        <button type="default" class="hqcode" style="background-color: #DD524D;width: 50px;height: 50px;" @click="iponeGetUsercode()">获取验证码</button>
	</view>
	<view class="text-area1">
	 验证码：<input v-model="userform.usercode" placeholder="输入您的验证码">
	</view>
		<view class="text-area2">
			 <button type="default" style="background-color: #4CD964;" @click="userlogin()">登录</button>
			 <text v-model="mesg"></text>
		</view>
	</view>
	
	
</template>

<script>
	export default {
		data() {
			return {
				mesg : '',
				title: '亲！登录吧',
				userform :{
					ipone : '',
				    usercode : '',
				}
			}
		},
		onLoad() {

		},
		methods: {
			iponeGetUsercode(){
					uni.request({
					url: 'http://localhost:7001/user/user/getusercodebyipone',
					method:'POST',
					data: {
						ipone : this.userform.ipone
					},
					success: (res) => {
						console.log(res.data)
					},
					
				}) 
			}
			},
		
			userlogin(){
				console.log('login')
				uni.request({
					url: 'http://localhost:7001/user/user/login',
					data: {
						Tbuser : this.userform
					},
					success: (res) => {
						console.log(res.data)
					},
					
				})
				/* uni.request({
					url: 'http://localhost:7001/user/user/login',
					data: this.userform
					success : (res) => {
						if(res.code == 200){
							uni.navigateTo({
								url: '/pages/case/index'
							});
						}else{
							this.mesg=res.mesg
						}
					}
					
				}) */
			}
		}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.text-area1 {
		display: flex;
		justify-content: left;
	}

	.title {
		font-size: 36rpx;
		color: #555500;
	}
	.hqcode {
		background-color: #DD524D;
		font-size: 10px;
	}
</style>
